Contains a value that is compared to the resulting value of an expression in a Select...Case statement. If the values match, statements in the Case block run.
Note: Case statements cannot have multiple delimited values. Only define one value per Case statement.
Syntax
Select Case TestExpression
[Case Expression
[Statements-n]]...
[Case Else Expression
[ElseStatements-n]]
End Select
Arguments
| Argument | Description |
|---|---|
| Expression | Numeric or string expression. For example, a > b, a < b, a = b, or a <> b. |
Example
SRand()
random = Rand(1, 3)
Select Case random
Case 1
PrintLn("1 is the random number")
Case 2
PrintLn("The random number is 2")
Case 3
PrintLn("The number 3 was randomly generated")
Case 4
PrintLn("Random value = 4")
Case Else
PrintLn("The number 5 was chosen")
End Select